<template>
  <div class="service-project-management">
    <div class="top">
      <div></div>
      <span>服务包管理</span>
    </div>
    <!-- 下拉菜单 -->

    <div class="xia_la">
      <div>
        <div class="span">服务包状态：</div>
        <el-select
          v-model="value"
          class="m-2"
          placeholder="请选择"
          size="large"
        >
          <el-option
            v-for="item in options"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          />
        </el-select>
      </div>
      <!-- 搜索 -->
      <div class="demo-input-suffix">
        <el-row :gutter="20" maxlength="400">
          <el-input
            v-model="input4"
            class="w-50 m-2"
            placeholder="请输入关键字"
            maxlength="400"
          >
            <template #suffix>
              <el-icon class="el-input__icon"><search /></el-icon>
            </template>
          </el-input>
        </el-row>
      </div>

      <!-- 新增按钮 -->
      <el-button type="primary" @click="toNewAddServiceItem"
        >新增服务项目</el-button
      >
    </div>

    <!-- 表格 -->
    <div class="table">
      <el-table
        :data="projectData"
        style="width: 90%"
        highlight-current-row:true
      >
        <el-table-column prop="id" label="项目编号" width="180" />
        <el-table-column prop="projectName" label="项目名称" width="180" />
        <el-table-column prop="timeNum" label="次数" width="180" />
        <el-table-column prop="projectType" label="项目类型" width="180" />
        <el-table-column prop="projectPrice" label="项目原价" width="180" />
        <el-table-column prop="projectTitle" label="项目介绍" width="180" />
        <el-table-column fixed="right" label="操作" width="250">
          <template #default>
            <span style="color: blue; margin-right: 5px; padding: 0 5px 0 5px"
              >编辑</span
            >
            <span style="color: red; margin-right: 5px; padding: 0 5px 0 5px"
              >删除</span
            >
          </template>
        </el-table-column>
      </el-table>
    </div>

    <!-- 分页 -->
    <div class="my_page">
      <el-pagination
        background
        layout="prev, pager, next"
        :total="projectData.length"
      />
    </div>
  </div>
</template>

<script>
export default {
  name: "ServiceProjectManagement",
  data() {
    return {
      value: "",
      input4: "",
      projectData: Array(20)
        .fill(null)
        .map((_, index) => ({
          id: Math.random() + index + 1,
          projectName: "心脑血管",
          timeNum: 2,
          projectType: Math.random() < 0.5 ? true : false,
          projectPrice: 3,
          projectTitle: "hajksdhf" + index + 1,
        })),
      options: [
        {
          value: "全部",
          label: "全部",
        },
        {
          value: "付费项目",
          label: "付费项目",
        },
        {
          value: "免费项目",
          label: "免费项目",
        },
      ],
    };
  },
  methods: {
    toNewAddServiceItem() {
      this.$router.push("/data-management/new-add-service-item");
    },
  },
};
</script>

<style lang="less" scoped>
.service-pack-management {
  .table{
    text-align: center;
  }
}
.top {
  padding: 10px;
  width: 100%;
  height: 40px;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  font-size: 22px;
  margin-top: 10px;
  div {
    width: 5px;
    height: 25px;
    background: blue;
    border-radius: 5px;
    margin-right: 10px;
  }
}
.xia_la {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 100px;
  width: 100%;
  margin-top: 20px;
  .el-input__inner {
    width: 400px;
  }
  div {
    float: left;
  }
  .span {
    float: left;
    line-height: 50px;
    font-size: 18px;
  }
}
.my_page {
  width: 100%;
  text-align: center;
  height: 80px;
}
</style>
